package com.janko.redislock;

import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Author nyk
 * @Date 2021/4/14 17:08
 * @Version 1.0
 * @Desc
 */
@RestController
public class BaseController {
    public static void main(String[] args) {
        List<String> list = Arrays.asList("123", "45634", "7892", "abch", "sdfhrthj", "mvkd");
        list = new ArrayList<>(list);
        list.add(2,"99999");
        AtomicInteger m= new AtomicInteger();
        m.set(0);
        list.stream().forEach(e ->{
            if (e.equals("abch") || m.get() == 1) {
                m.set(1);
                return;
            }
            System.out.println(e);
        });
    }
}
